<?php

namespace App;

use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;

/**
 * App\User
 *
 * @mixin \Eloquent
 * @property int $id 用户标识
 * @property string|null $username 用户名
 * @property string|null $email 用户邮箱
 * @property string|null $phone 用户电话
 * @property string|null $unionid unionid 针对微信登录用户
 * @property string|null $openid openid 针对微信登录用户
 * @property string $password 密码
 * @property string $reg_ip 注册ip
 * @property string $reg_time 注册时间
 * @property string|null $login_ip 最后登录ip
 * @property string|null $login_time 最后登录时间
 * @property int|null $login_count 登录次数
 * @property int $role 登录角色
 * @property int $status 用户状态,0锁定,1正常
 * @property string|null $remember_token
 * @property string|null $deleted_at
 * @property \Carbon\Carbon|null $created_at
 * @property \Carbon\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|\App\User whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\User whereDeletedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\User whereEmail($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\User whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\User whereLoginCount($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\User whereLoginIp($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\User whereLoginTime($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\User whereOpenid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\User wherePassword($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\User wherePhone($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\User whereRegIp($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\User whereRegTime($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\User whereRememberToken($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\User whereRole($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\User whereStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\User whereUnionid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\User whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\User whereUsername($value)
 * @property string|null $wx_unionid unionid 针对微信登录用户
 * @property string|null $wx_openid openid 针对微信登录用户
 * @property string|null $wx_session_key 微信返回的状态
 * @method static \Illuminate\Database\Eloquent\Builder|\App\User whereWxOpenid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\User whereWxSessionKey($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\User whereWxUnionid($value)
 * @property-read \App\Userinfo $userInfo
 */
class User extends Model implements AuthenticatableContract, CanResetPasswordContract
{
    use Authenticatable, CanResetPassword;

    protected $table = 'users';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];

    /**
     * The attributes excluded from the model's JSON form.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    public function userInfo(){
        return $this->hasOne('App\Userinfo','user_id');
    }
}
